https://retellai.com/?utm_source=discord&utm_medium=seo logo
I click publish on my ai chatot but coding says it...
# ❓・ai-evy-support
a
Thanks for tagging me @Tubussie. I'll look through relevant sources and get back to you shortly.
### Answer When you publish a chat agent, it creates a new draft version with
is_published: false
. [(1) ]() The response you're seeing shows
version: 1
with
is_published: false
— this is expected behavior. Publishing creates a new draft agent with a newer version number. To publish your chat agent via the API, use:
Copy code
javascript
import Retell from 'retell-sdk';
const client = new Retell({
  apiKey: 'YOUR_RETELL_API_KEY',
}) ;
await client.chatAgent.publish('16b980523634a6dc504898cda492e939') ;
Key points: - The
is_published
property cannot be updated via the Update Agent API — once a version is published, that version's configuration is locked. [(2) ]() - After publishing, the previously current version becomes the published one, and a new draft version is created (which shows
is_published: false
) . [(1) ]() If you're retrieving the agent and seeing
is_published: false
, you're likely looking at the new draft version, not the published version. You may need to check the [Get Agent Versions]() endpoint to see all versions and their publish status. [(3) ]()
​ To learn more, see the sources I considered: [[1] Publish Chat Agent](https://docs.retellai.com/api-references/publish-chat-agent) [[2] is_published" property of agents is not updating via "update agent " Api](https://discord.com/channels/1186424376300679209/1384428840247361587) [[3] Get Agent Versions](https://docs.retellai.com/api-references/get-agent-versions) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy [{"agent_id":"agent_a868b4d0745a7f862dd2e8471c","channel":"chat","last_modification_timestamp":1768506848020,"agent_name":"Vireon AI Testing final 15 Jan","version_description":"Testing V0","response_engine":{"type":"retell-llm","llm_id":"llm_bb28a8e442b4f58692a438fe2a9a","version":0},"webhook_timeout_ms":20000,"language":"en-US","data_storage_setting":"everything","opt_in_signed_url":false,"version":0,"is_published":true,"version_title":"Testing V0","post_call_analysis_model":"gpt-4.1-mini","pii_config":{"mode":"post_call","categories":[]},"analysis_successful_prompt":"Evaluate whether the agent seems to have a successful chat with the user, where the agent finishes the task, and the chat was complete without being cutoff.","analysis_summary_prompt":"Write a 1-3 sentence summary of the chat based on the messages. Should capture the important information and actions taken during the chat.","post_chat_analysis_model":"gpt-4.1-mini"},{"agent_id":"agent_a868b4d0745a7f862dd2e8471c","channel":"chat","last_modification_timestamp":1768506846021,"agent_name":"Vireon AI Testing final 15 Jan","version_description":"Testing V0","response_engine":{"type":"retell-llm","llm_id":"llm_bb28a8e442b4f58692a438fe2a9a","version":1},"webhook_timeout_ms":20000,"language":"en-US","data_storage_setting":"everything","opt_in_signed_url":false,"version":1,"is_published":false,"version_title":"Testing V0","post_call_analysis_model":"gpt-4.1-mini","pii_config":{"mode":"post_call","categories":[]},"analysis_successful_prompt":"Evaluate whether the agent seems to have a successful chat with the user, where the agent finishes the task, and the chat was complete without being cutoff.","analysis_summary_prompt":"Write a 1-3 sentence summary of the chat based on the messages. Should capture the important information and actions taken during the chat.","post_chat_analysis_model":"gpt-4.1-mini"}]
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
### Answer Your data shows everything is working correctly: - Version 0 has
is_published: true
— this is your published/live version [(1) ]() - Version 1 has
is_published: false
— this is your new draft version When you publish, the current version becomes locked as the published version, and a new draft version is automatically created for future edits. [(2) ]() If your code is checking
is_published
and returning false, you're likely retrieving the draft version (version 1) instead of the published version (version 0) . To get the published version specifically, use the
version
query parameter when retrieving your chat agent:
Copy code
javascript
const chatAgentResponse = await client.chatAgent.retrieve('16b980523634a6dc504898cda492e939') ;
[(3) ]() You can also use the [Get Agent Versions]() endpoint to list all versions and filter for the one where
is_published: true
. [(1) ]()
​ To learn more, see the sources I considered: [[1] Get Agent Versions](https://docs.retellai.com/api-references/get-agent-versions) [[2] Discord message from @trxgames9630 on 2025-12-15](https://discord.com/channels/1186424376300679209/1294891368505937952/1449927476359725127) [[3] Get Chat Agent](https://docs.retellai.com/api-references/get-chat-agent) ​
t
@AI Evy here is my code: " Retell Chat Widget Example <script id="retell-widget" src="https://dashboard.retellai.com/retell-widget.js" data-public-key="public_key_6510c185506872b0e9467" data-agent-id="agent_a868b4d0745a7f862dd2e8471c" data-agent-version="0" data-title="Chat with us!" data-recaptcha-key="6Ld0ckksAAAAAAFoCUrSVp2AIu7nDeAY-ntU_zfq" > " why am i still getting 404 error
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer Your code structure looks correct based on the documentation. [(1) ]() A 404 error with the chat widget typically indicates one of these issues: 1. Domain not configured in Public Key settings Public keys are restricted to specific domains for security. [(2) ]() You need to add your domain to the allowed domains list in the Retell dashboard: - Navigate to Keys → Public Keys - Click on your public key - Add the domain where you're hosting this page (e.g.,
example.com
or
localhost
for local testing) 2. Missing
type="module"
attribute
Your script tag is missing the
type="module"
attribute. The documentation shows it should be included: [(1) ]()
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_CHAT_AGENT_ID"
  data-agent-version="YOUR_AGENT_VERSION"
  data-title="YOUR_CUSTOM_TITLE"
  data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY"
></script>
3. Verify your public key format Ensure your public key starts with the correct prefix (typically
key_
based on documentation examples) . To troubleshoot: - Add
localhost
to your allowed domains if testing locally [(2) ]() - Add
type="module"
to your script tag - Confirm the public key and agent ID are correct in your dashboard
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Public Keys](https://docs.retellai.com/accounts/public-keys) ​
t
@AI Evy<script id="retell-widget" src="https://dashboard.retellai.com/retell-widget.js" type="module" data-public-key="public_key_6510c185506872b0e9467" data-agent-id="agent_a868b4d0745a7f862dd2e8471c" data-agent-version="0" data-title="Vireon AI ChatBot" data-logo-url="https://image2url.com/r2/default/images/1768507541481-5d44b6eb-c3db-419a-8bea-f5e642d437b6.jpg" data-color="#0E3B2C" data-bot-name="Vireon" data-popup-message="Let Me Help!" data-show-ai-popup="true" data-show-ai-popup-time="5" data-auto-open="false" data-dynamic='{"key": "value"}' data-recaptcha-key="6Ld0ckksAAAAAAFoCUrSVp2AIu7nDeAY-ntU_zfq" > still 404 error
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer Your script order is incorrect. The reCAPTCHA script must load before the widget script. [(1) ]() Correct order:
Copy code
html
<script src="<https://www.google.com/recaptcha/api.js?render=YOUR_GOOGLE_RECAPTCHA_SITE_KEY>"></script>
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="key_xxxxxxxxxxxxxxxxxxxxx"
  data-agent-id="agent_xxxxxxxxxxxxxxxxxxx"
  data-agent-version="0"
  data-title="Chat with us!"
  data-recaptcha-key="YOUR_GOOGLE_RECAPTCHA_SITE_KEY"
></script>
Additional checks: 1. Public key format — Documentation examples show keys starting with
key_
(e.g.,
key_xxxxxxxxxxxxxxxxxxxxx
) , but yours starts with
public_key_
. Verify this is the correct format from your dashboard. 2. Domain allowlist — Ensure the domain where you're hosting this page is added to your public key's allowed domains in Dashboard → Keys → Public Keys. [(2) ]() , [(3) ]() 3. reCAPTCHA enabled — If using reCAPTCHA, make sure it's enabled for your public key in the dashboard settings. [(2) ]() Try swapping the script order first and verify your public key format matches what's shown in your Retell dashboard.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
​ To learn more, see the sources I considered: [[1] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) [[2] Platform Changelogs | Retell AI](https://www.retellai.com/changelog) [[3] Chat Widget, Custom Function Enhancement and more!](https://www.retellai.com/changelog/chat-widget-custom-function-enhancement-and-more) ​
t
@AI Evy i switched it to key_, noew I have 401 error
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
### Answer A 401 error means authentication failed. [(1) ]() Most likely causes: 1. Wrong key type — You should be using your Public Key from Dashboard → Keys → Public Keys, not an API key. The public key format shown in your original code (
public_key_...
) was likely correct. 2. Domain not in allowlist — Your domain must be added to the allowed domains for that public key. Navigate to Public Keys in your dashboard, click on your key, and add your domain (e.g.,
vireonai.co.za
or
localhost
for testing) . 3. WordPress path issue — Based on your earlier message, your widget loads from
vireonai.co.za/wp/
but you may only have
vireonai.co.za
allowed. Check DevTools to see the exact Origin being sent on the failed request. [(2) ]() To fix: - Use your public key (the one starting with
public_key_
) , not
key_
- Add the exact domain/path where the widget is hosted to your allowed domains list [(1) ]() - If testing locally, add
localhost
to allowed domains
​ To learn more, see the sources I considered: [[1] Public Keys](https://docs.retellai.com/accounts/public-keys) [[2] Discord message from @itstubzy on 2026-01-13](https://discord.com/channels/1186424376300679209/1294891368505937952/1460668540058079365) ​
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.
t
@AI Evy "The 404 Not Found error for https://api.retellai.com/get-chat/undefined occurs because the chat ID, represented by the n variable in the internal retell-widget.js code, is undefined. To fix this, ensure that a valid chat ID is always provided as an argument to the function (f in the snippet) that triggers this API call, or verify your Retell AI widget configuratio"
a
Thanks for the follow-up, @Tubussie. I'll get back to you soon.
​ To learn more, see the sources I considered: [[1] Get Chat](https://docs.retellai.com/api-references/get-chat) [[2] Retell Website Widget](https://docs.retellai.com/deploy/chat-widget) ​
### Answer The
get-chat/undefined
error indicates the widget is attempting to retrieve a chat session but no valid
chat_id
is being passed. [(1) ]() Likely causes: 1. Chat session not initializing properly — The widget may be failing to create a chat session before attempting to retrieve it. This could stem from authentication issues (the 401 error you saw earlier) preventing the initial chat creation. 2. Public key/domain mismatch still present — If authentication fails during chat initialization, no
chat_id
gets generated, causing subsequent API calls to pass
undefined
. [(2) ]() Recommended steps: - Open your browser's DevTools → Network tab - Filter by
retellai.com
requests - Look for the first failing request — this is likely the root cause - Check if there's a
create-chat
or similar request failing before the
get-chat/undefined
call Verify your configuration matches the documented format:
Copy code
html
<script
  id="retell-widget"
  src="<https://dashboard.retellai.com/retell-widget.js%22>
  type="module"
  data-public-key="YOUR_RETELL_PUBLIC_KEY"
  data-agent-id="YOUR_CHAT_AGENT_ID"
  data-agent-version="YOUR_AGENT_VERSION"
></script>
The
undefined
chat ID suggests an upstream failure is preventing proper session initialization. Resolving the authentication/domain configuration should fix this.
Feel free to tag @AI Evy with additional questions. I also appreciate feedback, it helps me improve.